<?php
require_once $_SERVER['srcPath'].'/User.php';
use GrouppaGroup\User;

class UserTest extends PHPUnit_Framework_TestCase
{
	
	public function datatForTest(){
		return array(
				array(strtotime("now")), //case it is the default last online time;
				array(strtotime("now +60 second")), //
				array(strtotime("now -60 second")),
				array(65),
				array(0)
		);
	}
	
	/**
	 * @dataProvider datatForTest
	 * @param unknown $date_online
	 */
	public function testIs_online($date_online){
		$createdDate_online = User::is_online($date_online);
		$currentTime = strtotime("now");
		
		
		if ($date_online+USER_ONLINE_TIME > $currentTime){
			$this->assertEquals(User::is_online($date_online),true);
		}else{
			$this->assertEquals(User::is_online($date_online),false);
		}
		
	}
}